<?php

class Model_Alerts {

    protected $alert_id;
    protected $email;
    protected $user_id;
    protected $search;
    protected $secret;
    protected $active;
    protected $type;

    public function __construct(array $options = null) {
        if (is_array($options)) {
            $this->setOptions($options);
        }
    }

    public function __set($name, $value) {
        $method = 'set' . ucfirst($name);
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid content property');
        }
        $this->$method($value);
    }

    public function __get($name) {
        $method = 'get' . ucfirst($name);
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid content property');
        } return $this->$method();
    }

    public function setOptions(array $options) {
        $methods = get_class_methods($this);
        foreach ($options as $key => $value) {
            $method = 'set' . ucfirst($key);
            if (in_array($method, $methods)) {
                $this->$method($value);
            }
        }
    }

    public function setAlert_id($value) {
        $this->alert_id = $value;
    }

    public function getAlert_id() {
        return $this->alert_id;
    }

    public function setEmail($value) {
        $this->email = $value;
    }

    public function getEmail() {
        return $this->email;
    }

    public function setUser_id($value) {
        $this->user_id = $value;
    }

    public function getUser_id() {
        return $this->user_id;
    }

    public function setSearch($value) {
        $this->search = $value;
    }

    public function getSearch() {
        return $this->search;
    }

    public function setSecret($value) {
        $this->secret = $value;
    }

    public function getSecret() {
        return $this->secret;
    }

    public function setActive($value) {
        $this->active = $value;
    }

    public function getActive() {
        return $this->active;
    }

    public function setType($value) {
        $this->type = $value;
    }

    public function getType() {
        return $this->type;
    }

    public function toArray() {
        return get_object_vars($this);
    }

}

